
import numpy as np
import cv2
import time
cap = cv2.VideoCapture("../video/basketball1.mp4")
start_time = time.time()
while True:
    ret, frame = cap.read()

    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
    cv2.imshow('frame', gray)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break
cap.release()
cv2.destroyAllWindows()
'''
import cv2
import sys
imagePath = "../images/haar2.jpg"
faceCascade = cv2.CascadeClassifier("../cascade/haarcascade_frontalface_alt2.xml")
image = cv2.imread(imagePath)
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
faces = faceCascade.detectMultiScale(
    gray,
    scaleFactor=1.15,
    minNeighbors=5
#    minSize=(5, 5)

)
print("found {0} faces!".format(len(faces)))
for (x, y, w, h) in faces:
    cv2.rectangle(image, (x, y), (x+w, y+h), (0, 255, 0), 2)
cv2.imshow('mark', image)
cv2.waitKey()
'''